"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var core_1 = require("@angular/core");
var api_1 = require("../../../config/api");
var moment = require("moment");
var IntegralComponent = /** @class */ (function () {
    function IntegralComponent(httpService, el, router) {
        var _this = this;
        this.httpService = httpService;
        this.el = el;
        this.router = router;
        this.aliyunOssOutputUrl = api_1.AliyunOssOutputUrl;
        this.searchData = '';
        this.isShow = true;
        this.currentPage = 1;
        this.itemsPerPage = 20;
        this._isSpinning = false;
        this.editItem = [];
        this.integralList = [];
        this._startDate = null;
        this._endDate = null;
        this.startDate = null;
        this.endDate = null;
        this.url = api_1.tuikeSystemUrl + "/api/v1/admin/Task/jifen";
        this._startValueChange = function () {
            if (_this._startDate > _this._endDate) {
                _this._endDate = null;
            }
        };
        this._endValueChange = function () {
            if (_this._startDate > _this._endDate) {
                _this._startDate = null;
            }
        };
        this._disabledStartDate = function (startValue) {
            if (!startValue || !_this._endDate) {
                return false;
            }
            return startValue.getTime() >= _this._endDate.getTime();
        };
        this._disabledEndDate = function (endValue) {
            if (!endValue || !_this._startDate) {
                return false;
            }
            return endValue.getTime() <= _this._startDate.getTime();
        };
    }
    IntegralComponent.prototype._console = function (value) {
        console.log(value);
    };
    IntegralComponent.prototype.ngOnInit = function () {
        this._startDate = new Date(moment(new Date().getTime()).format('YYYY-MM-DD') + ' 00:00:00');
        this.getIntegralList(1);
    };
    //重置
    IntegralComponent.prototype.reset = function () {
        this.searchData = '';
        this._startDate = new Date(moment(new Date().getTime()).format('YYYY-MM-DD') + ' 00:00:00');
        this._endDate = null;
        this.currentPage = 1;
        this.getIntegralList(1);
    };
    //搜索
    IntegralComponent.prototype.search = function () {
        this.getIntegralList(1);
    };
    IntegralComponent.prototype.closeMask = function () {
        this.el.nativeElement.querySelector('.mask').style.display = 'none';
    };
    IntegralComponent.prototype.showDetailModal = function (item) {
        this.editItem = item;
        this.detailModal.show();
    };
    IntegralComponent.prototype.getIntegralList = function (page) {
        var _this = this;
        this._isSpinning = true;
        this.startDate = this._startDate ? moment(this._startDate).format('YYYY-MM-DD 00:00:00') : '';
        this.endDate = this._endDate ? moment(this._endDate).format('YYYY-MM-DD 23:59:59') : '';
        this.httpService.httpGetAuth(this.url + '?start_date=' + this.startDate + '&key=' + this.searchData).subscribe(function (res) {
            if (res.code === 200) {
                _this.integralList = res.data.member;
                _this._isSpinning = false;
            }
        });
    };
    IntegralComponent.prototype.pageChanged = function (event) {
        window.scrollTo(0, 0);
        this.getIntegralList(event.page);
    };
    __decorate([
        core_1.ViewChild('detailModal')
    ], IntegralComponent.prototype, "detailModal", void 0);
    IntegralComponent = __decorate([
        core_1.Component({
            selector: 'app-examine',
            templateUrl: './integral.component.html',
            styleUrls: ['./integral.component.scss']
        })
    ], IntegralComponent);
    return IntegralComponent;
}());
exports.IntegralComponent = IntegralComponent;
